<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />

<meta name="viewport" content="width=device-width, initial-scale=1">

<meta name="author" content="David Brocks" />

<meta name="date" content="2019-08-20" />

<title>Repsc vignette</title>



<style type="text/css">code{white-space: pre;}</style>
<style type="text/css" data-origin="pandoc">
div.sourceCode { overflow-x: auto; }
table.sourceCode, tr.sourceCode, td.lineNumbers, td.sourceCode {
  margin: 0; padding: 0; vertical-align: baseline; border: none; }
table.sourceCode { width: 100%; line-height: 100%; }
td.lineNumbers { text-align: right; padding-right: 4px; padding-left: 4px; color: #aaaaaa; border-right: 1px solid #aaaaaa; }
td.sourceCode { padding-left: 5px; }
code > span.kw { color: #007020; font-weight: bold; } /* Keyword */
code > span.dt { color: #902000; } /* DataType */
code > span.dv { color: #40a070; } /* DecVal */
code > span.bn { color: #40a070; } /* BaseN */
code > span.fl { color: #40a070; } /* Float */
code > span.ch { color: #4070a0; } /* Char */
code > span.st { color: #4070a0; } /* String */
code > span.co { color: #60a0b0; font-style: italic; } /* Comment */
code > span.ot { color: #007020; } /* Other */
code > span.al { color: #ff0000; font-weight: bold; } /* Alert */
code > span.fu { color: #06287e; } /* Function */
code > span.er { color: #ff0000; font-weight: bold; } /* Error */
code > span.wa { color: #60a0b0; font-weight: bold; font-style: italic; } /* Warning */
code > span.cn { color: #880000; } /* Constant */
code > span.sc { color: #4070a0; } /* SpecialChar */
code > span.vs { color: #4070a0; } /* VerbatimString */
code > span.ss { color: #bb6688; } /* SpecialString */
code > span.im { } /* Import */
code > span.va { color: #19177c; } /* Variable */
code > span.cf { color: #007020; font-weight: bold; } /* ControlFlow */
code > span.op { color: #666666; } /* Operator */
code > span.bu { } /* BuiltIn */
code > span.ex { } /* Extension */
code > span.pp { color: #bc7a00; } /* Preprocessor */
code > span.at { color: #7d9029; } /* Attribute */
code > span.do { color: #ba2121; font-style: italic; } /* Documentation */
code > span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */
code > span.cv { color: #60a0b0; font-weight: bold; font-style: italic; } /* CommentVar */
code > span.in { color: #60a0b0; font-weight: bold; font-style: italic; } /* Information */

</style>
<script>
// apply pandoc div.sourceCode style to pre.sourceCode instead
(function() {
  var sheets = document.styleSheets;
  for (var i = 0; i < sheets.length; i++) {
    if (sheets[i].ownerNode.dataset["origin"] !== "pandoc") continue;
    try { var rules = sheets[i].cssRules; } catch (e) { continue; }
    for (var j = 0; j < rules.length; j++) {
      var rule = rules[j];
      // check if there is a div.sourceCode rule
      if (rule.type !== rule.STYLE_RULE || rule.selectorText !== "div.sourceCode") continue;
      var style = rule.style.cssText;
      // check if color or background-color is set
      if (rule.style.color === '' || rule.style.backgroundColor === '') continue;
      // replace div.sourceCode by a pre.sourceCode rule
      sheets[i].deleteRule(j);
      sheets[i].insertRule('pre.sourceCode{' + style + '}', j);
    }
  }
})();
</script>



<link href="data:text/css;charset=utf-8,body%20%7B%0Abackground%2Dcolor%3A%20%23fff%3B%0Amargin%3A%201em%20auto%3B%0Amax%2Dwidth%3A%20700px%3B%0Aoverflow%3A%20visible%3B%0Apadding%2Dleft%3A%202em%3B%0Apadding%2Dright%3A%202em%3B%0Afont%2Dfamily%3A%20%22Open%20Sans%22%2C%20%22Helvetica%20Neue%22%2C%20Helvetica%2C%20Arial%2C%20sans%2Dserif%3B%0Afont%2Dsize%3A%2014px%3B%0Aline%2Dheight%3A%201%2E35%3B%0A%7D%0A%23header%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0A%23TOC%20%7B%0Aclear%3A%20both%3B%0Amargin%3A%200%200%2010px%2010px%3B%0Apadding%3A%204px%3B%0Awidth%3A%20400px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Aborder%2Dradius%3A%205px%3B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Afont%2Dsize%3A%2013px%3B%0Aline%2Dheight%3A%201%2E3%3B%0A%7D%0A%23TOC%20%2Etoctitle%20%7B%0Afont%2Dweight%3A%20bold%3B%0Afont%2Dsize%3A%2015px%3B%0Amargin%2Dleft%3A%205px%3B%0A%7D%0A%23TOC%20ul%20%7B%0Apadding%2Dleft%3A%2040px%3B%0Amargin%2Dleft%3A%20%2D1%2E5em%3B%0Amargin%2Dtop%3A%205px%3B%0Amargin%2Dbottom%3A%205px%3B%0A%7D%0A%23TOC%20ul%20ul%20%7B%0Amargin%2Dleft%3A%20%2D2em%3B%0A%7D%0A%23TOC%20li%20%7B%0Aline%2Dheight%3A%2016px%3B%0A%7D%0Atable%20%7B%0Amargin%3A%201em%20auto%3B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dcolor%3A%20%23DDDDDD%3B%0Aborder%2Dstyle%3A%20outset%3B%0Aborder%2Dcollapse%3A%20collapse%3B%0A%7D%0Atable%20th%20%7B%0Aborder%2Dwidth%3A%202px%3B%0Apadding%3A%205px%3B%0Aborder%2Dstyle%3A%20inset%3B%0A%7D%0Atable%20td%20%7B%0Aborder%2Dwidth%3A%201px%3B%0Aborder%2Dstyle%3A%20inset%3B%0Aline%2Dheight%3A%2018px%3B%0Apadding%3A%205px%205px%3B%0A%7D%0Atable%2C%20table%20th%2C%20table%20td%20%7B%0Aborder%2Dleft%2Dstyle%3A%20none%3B%0Aborder%2Dright%2Dstyle%3A%20none%3B%0A%7D%0Atable%20thead%2C%20table%20tr%2Eeven%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0A%7D%0Ap%20%7B%0Amargin%3A%200%2E5em%200%3B%0A%7D%0Ablockquote%20%7B%0Abackground%2Dcolor%3A%20%23f6f6f6%3B%0Apadding%3A%200%2E25em%200%2E75em%3B%0A%7D%0Ahr%20%7B%0Aborder%2Dstyle%3A%20solid%3B%0Aborder%3A%20none%3B%0Aborder%2Dtop%3A%201px%20solid%20%23777%3B%0Amargin%3A%2028px%200%3B%0A%7D%0Adl%20%7B%0Amargin%2Dleft%3A%200%3B%0A%7D%0Adl%20dd%20%7B%0Amargin%2Dbottom%3A%2013px%3B%0Amargin%2Dleft%3A%2013px%3B%0A%7D%0Adl%20dt%20%7B%0Afont%2Dweight%3A%20bold%3B%0A%7D%0Aul%20%7B%0Amargin%2Dtop%3A%200%3B%0A%7D%0Aul%20li%20%7B%0Alist%2Dstyle%3A%20circle%20outside%3B%0A%7D%0Aul%20ul%20%7B%0Amargin%2Dbottom%3A%200%3B%0A%7D%0Apre%2C%20code%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0Aborder%2Dradius%3A%203px%3B%0Acolor%3A%20%23333%3B%0Awhite%2Dspace%3A%20pre%2Dwrap%3B%20%0A%7D%0Apre%20%7B%0Aborder%2Dradius%3A%203px%3B%0Amargin%3A%205px%200px%2010px%200px%3B%0Apadding%3A%2010px%3B%0A%7D%0Apre%3Anot%28%5Bclass%5D%29%20%7B%0Abackground%2Dcolor%3A%20%23f7f7f7%3B%0A%7D%0Acode%20%7B%0Afont%2Dfamily%3A%20Consolas%2C%20Monaco%2C%20%27Courier%20New%27%2C%20monospace%3B%0Afont%2Dsize%3A%2085%25%3B%0A%7D%0Ap%20%3E%20code%2C%20li%20%3E%20code%20%7B%0Apadding%3A%202px%200px%3B%0A%7D%0Adiv%2Efigure%20%7B%0Atext%2Dalign%3A%20center%3B%0A%7D%0Aimg%20%7B%0Abackground%2Dcolor%3A%20%23FFFFFF%3B%0Apadding%3A%202px%3B%0Aborder%3A%201px%20solid%20%23DDDDDD%3B%0Aborder%2Dradius%3A%203px%3B%0Aborder%3A%201px%20solid%20%23CCCCCC%3B%0Amargin%3A%200%205px%3B%0A%7D%0Ah1%20%7B%0Amargin%2Dtop%3A%200%3B%0Afont%2Dsize%3A%2035px%3B%0Aline%2Dheight%3A%2040px%3B%0A%7D%0Ah2%20%7B%0Aborder%2Dbottom%3A%204px%20solid%20%23f7f7f7%3B%0Apadding%2Dtop%3A%2010px%3B%0Apadding%2Dbottom%3A%202px%3B%0Afont%2Dsize%3A%20145%25%3B%0A%7D%0Ah3%20%7B%0Aborder%2Dbottom%3A%202px%20solid%20%23f7f7f7%3B%0Apadding%2Dtop%3A%2010px%3B%0Afont%2Dsize%3A%20120%25%3B%0A%7D%0Ah4%20%7B%0Aborder%2Dbottom%3A%201px%20solid%20%23f7f7f7%3B%0Amargin%2Dleft%3A%208px%3B%0Afont%2Dsize%3A%20105%25%3B%0A%7D%0Ah5%2C%20h6%20%7B%0Aborder%2Dbottom%3A%201px%20solid%20%23ccc%3B%0Afont%2Dsize%3A%20105%25%3B%0A%7D%0Aa%20%7B%0Acolor%3A%20%230033dd%3B%0Atext%2Ddecoration%3A%20none%3B%0A%7D%0Aa%3Ahover%20%7B%0Acolor%3A%20%236666ff%3B%20%7D%0Aa%3Avisited%20%7B%0Acolor%3A%20%23800080%3B%20%7D%0Aa%3Avisited%3Ahover%20%7B%0Acolor%3A%20%23BB00BB%3B%20%7D%0Aa%5Bhref%5E%3D%22http%3A%22%5D%20%7B%0Atext%2Ddecoration%3A%20underline%3B%20%7D%0Aa%5Bhref%5E%3D%22https%3A%22%5D%20%7B%0Atext%2Ddecoration%3A%20underline%3B%20%7D%0A%0Acode%20%3E%20span%2Ekw%20%7B%20color%3A%20%23555%3B%20font%2Dweight%3A%20bold%3B%20%7D%20%0Acode%20%3E%20span%2Edt%20%7B%20color%3A%20%23902000%3B%20%7D%20%0Acode%20%3E%20span%2Edv%20%7B%20color%3A%20%2340a070%3B%20%7D%20%0Acode%20%3E%20span%2Ebn%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Efl%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Ech%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Est%20%7B%20color%3A%20%23d14%3B%20%7D%20%0Acode%20%3E%20span%2Eco%20%7B%20color%3A%20%23888888%3B%20font%2Dstyle%3A%20italic%3B%20%7D%20%0Acode%20%3E%20span%2Eot%20%7B%20color%3A%20%23007020%3B%20%7D%20%0Acode%20%3E%20span%2Eal%20%7B%20color%3A%20%23ff0000%3B%20font%2Dweight%3A%20bold%3B%20%7D%20%0Acode%20%3E%20span%2Efu%20%7B%20color%3A%20%23900%3B%20font%2Dweight%3A%20bold%3B%20%7D%20%20code%20%3E%20span%2Eer%20%7B%20color%3A%20%23a61717%3B%20background%2Dcolor%3A%20%23e3d2d2%3B%20%7D%20%0A" rel="stylesheet" type="text/css" />




</head>

<body>




<h1 class="title toc-ignore">Repsc vignette</h1>
<h4 class="author">David Brocks</h4>
<h4 class="date">2019-08-20</h4>



<div id="workflow-human-10x-scrna-seq-dataset-5" class="section level1">
<h1>Workflow human 10x scRNA-seq dataset (5’)</h1>
<p>In this tutorial, we are going to utilize 5’ scRNA-seq data on epigenetically de-repressed cancer cell lines to quantify transposable element (TE) expression levels at single-cell and locus resolution. Following the workflow, you’ll learn the specifics of Repsc to adapt it to your single-cell dataset.</p>
<div id="getting-started" class="section level2">
<h2>Getting started</h2>
<p>We start the workflow by loading Repsc and the human hg38 <em>BSgenome</em> object into our R environment:</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">Sys.time</span>()
<span class="co">#&gt; [1] &quot;2019-08-20 16:37:34 IDT&quot;</span>
devtools<span class="op">::</span><span class="kw">load_all</span>(<span class="st">'/net/mraid14/export/tgdata/users/davidbr/src/Repsc/'</span>)
<span class="co">#&gt; Loading Repsc</span>
devtools<span class="op">::</span><span class="kw">load_all</span>(<span class="st">'/net/mraid14/export/tgdata/users/davidbr/src/Reputils/'</span>)
<span class="co">#&gt; Loading Reputils</span>
devtools<span class="op">::</span><span class="kw">load_all</span>(<span class="st">'/net/mraid14/export/tgdata/users/davidbr/src/Repdata/'</span>)
<span class="co">#&gt; Loading Repdata</span>

<span class="kw">library</span>(BSgenome.Mmusculus.UCSC.mm10)
<span class="co">#&gt; Loading required package: BSgenome</span>
<span class="co">#&gt; Loading required package: BiocGenerics</span>
<span class="co">#&gt; Loading required package: parallel</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; Attaching package: 'BiocGenerics'</span>
<span class="co">#&gt; The following objects are masked from 'package:parallel':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply, parSapplyLB</span>
<span class="co">#&gt; The following objects are masked from 'package:Reputils':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, combine, intersect, parApply, parCapply, parLapply, parLapplyLB, parRapply, parSapply,</span>
<span class="co">#&gt;     parSapplyLB, setdiff, union, which</span>
<span class="co">#&gt; The following objects are masked from 'package:Repsc':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     clusterApply, clusterApplyLB, clusterCall, clusterEvalQ, clusterExport, clusterMap, combine, counts, intersect, parApply, parCapply, parLapply, parLapplyLB, parRapply,</span>
<span class="co">#&gt;     parSapply, parSapplyLB, setdiff, union, which</span>
<span class="co">#&gt; The following objects are masked from 'package:stats':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     IQR, mad, sd, var, xtabs</span>
<span class="co">#&gt; The following objects are masked from 'package:base':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     anyDuplicated, append, as.data.frame, basename, cbind, colMeans, colnames, colSums, dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep, grepl, intersect,</span>
<span class="co">#&gt;     is.unsorted, lapply, lengths, Map, mapply, match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank, rbind, Reduce, rowMeans, rownames, rowSums, sapply,</span>
<span class="co">#&gt;     setdiff, sort, table, tapply, union, unique, unsplit, which, which.max, which.min</span>
<span class="co">#&gt; Loading required package: S4Vectors</span>
<span class="co">#&gt; Loading required package: stats4</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; Attaching package: 'S4Vectors'</span>
<span class="co">#&gt; The following objects are masked from 'package:Reputils':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     first, rename, second, values</span>
<span class="co">#&gt; The following objects are masked from 'package:Repsc':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     first, rename, second, values</span>
<span class="co">#&gt; The following object is masked from 'package:base':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     expand.grid</span>
<span class="co">#&gt; Loading required package: IRanges</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; Attaching package: 'IRanges'</span>
<span class="co">#&gt; The following objects are masked from 'package:Reputils':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     collapse, desc, shift, slice, trim</span>
<span class="co">#&gt; The following objects are masked from 'package:Repsc':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     collapse, desc, shift, slice, trim</span>
<span class="co">#&gt; Loading required package: GenomeInfoDb</span>
<span class="co">#&gt; Loading required package: GenomicRanges</span>
<span class="co">#&gt; Loading required package: Biostrings</span>
<span class="co">#&gt; Loading required package: XVector</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; Attaching package: 'Biostrings'</span>
<span class="co">#&gt; The following object is masked from 'package:base':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     strsplit</span>
<span class="co">#&gt; Loading required package: rtracklayer</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; Attaching package: 'rtracklayer'</span>
<span class="co">#&gt; The following object is masked from 'package:Repsc':</span>
<span class="co">#&gt; </span>
<span class="co">#&gt;     export</span></code></pre></div>
</div>
<div id="create-scset" class="section level2">
<h2>Create scSet</h2>
<p>We then import our gene and TE annotation files as <a href="https://bioconductor.org/packages/release/bioc/vignettes/GenomicRanges/inst/doc/GenomicRangesIntroduction.html">GRanges objects</a> followed by Repsc-specific curation and formatting using the <code>curateGenes</code> and <code>curateTEs</code> functions.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># path to Gencode gtf file (provided)</span>
gene_path &lt;-<span class="st"> </span><span class="kw">system.file</span>(<span class="dt">package =</span> <span class="st">'Repdata'</span>, 
                        <span class="st">'extdata'</span>, 
                        <span class="st">'mm10'</span>,
                        <span class="st">'genes'</span>,
                        <span class="st">'gencode.vM22.annotation.gtf.gz'</span>)

<span class="co"># path to RepeatMasker mm10 repeat annotation (provided)</span>
rmsk_path &lt;-<span class="st"> </span><span class="kw">system.file</span>(<span class="dt">package =</span> <span class="st">'Repdata'</span>, 
                         <span class="st">'extdata'</span>, 
                         <span class="st">'mm10'</span>,
                         <span class="st">'tes'</span>,
                         <span class="st">'mm10.fa.out.gz'</span>)
                         
<span class="co"># creating the scSet</span>
sc &lt;-<span class="st"> </span><span class="kw">createScSet</span>(<span class="dt">genome   =</span> Mmusculus,
                  <span class="dt">protocol =</span> <span class="st">'fiveprime'</span>,
                  <span class="dt">tes      =</span> rmsk_path,
                  <span class="dt">genes    =</span> gene_path)
<span class="co">#&gt; Curating gene intervals</span>
<span class="co">#&gt; Curating TE intervals</span>
<span class="co">#&gt; Resolving overlaps</span>
<span class="co">#&gt; Labeling modified intervals</span>
<span class="co">#&gt; Labeling gene overlaps</span>
<span class="co">#&gt; Created new scSet at Tue Aug 20 16:41:47 2019</span></code></pre></div>
</div>
<div id="create-the-input-data.frame" class="section level2">
<h2>Create the input data.frame</h2>
<p>After we have imported and curated the data, we can procede to generate the actual read/UMI count matrix using the <code>compCounts</code> function.</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="co"># path to bam files containing mapped reads                         </span>
bam_paths &lt;-<span class="st">  </span><span class="kw">dir</span>(<span class="st">'/net/mraid14/export/data/users/davidbr/proj/eseb/data/'</span>, 
                  <span class="dt">recursive =</span> <span class="ot">TRUE</span>, 
                  <span class="dt">pattern =</span> <span class="st">'_deduplicated_chr[0-9, X, Y, MT]+.bam'</span>, 
                  <span class="dt">full.names =</span> <span class="ot">TRUE</span>)
                  
hdf5_paths &lt;-<span class="st"> </span><span class="kw">dir</span>(<span class="st">'/net/mraid14/export/data/users/davidbr/proj/eseb/data/'</span>,
                  <span class="dt">recursive =</span> <span class="ot">TRUE</span>,
                  <span class="dt">pattern =</span> <span class="st">'filtered_gene_bc_matrices_h5.h5'</span>,
                  <span class="dt">full.names =</span> <span class="ot">TRUE</span>)

<span class="co"># create a data.frame specifying import parameters                 </span>
input_df    &lt;-<span class="st"> </span><span class="kw">data.frame</span>(<span class="dt">paths   =</span> bam_paths,
                          <span class="dt">hdf5    =</span> <span class="kw">rep</span>(hdf5_paths, <span class="dt">each =</span> <span class="dv">22</span>),
                          <span class="dt">paired  =</span> <span class="ot">TRUE</span>,       <span class="co"># use FALSE for single-end libraries</span>
                          <span class="dt">mate    =</span> <span class="st">'first'</span>,    <span class="co"># only imports the first mate of properly aligned read pairs, set to NA when using single-end libraries</span>
                          <span class="dt">barcode =</span> <span class="st">'CB'</span>,       <span class="co"># 10x barcode included in BAM flag</span>
                          <span class="dt">chunk   =</span> <span class="kw">ntile</span>(bam_paths, <span class="dv">40</span>),
                          <span class="dt">meta    =</span> <span class="kw">gsub</span>(<span class="st">'/'</span>, <span class="st">''</span>, <span class="kw">substring</span>(bam_paths, <span class="dv">56</span>, <span class="dv">61</span>)),
                          <span class="dt">stringsAsFactors =</span> <span class="ot">FALSE</span>)
                        
<span class="kw">head</span>(input_df)                      
<span class="co">#&gt;                                                                                                                 paths</span>
<span class="co">#&gt; 1  /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/aligned/chunked_bams/possorted_deduplicated_chr1.bam</span>
<span class="co">#&gt; 2 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/aligned/chunked_bams/possorted_deduplicated_chr10.bam</span>
<span class="co">#&gt; 3 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/aligned/chunked_bams/possorted_deduplicated_chr11.bam</span>
<span class="co">#&gt; 4 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/aligned/chunked_bams/possorted_deduplicated_chr12.bam</span>
<span class="co">#&gt; 5 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/aligned/chunked_bams/possorted_deduplicated_chr13.bam</span>
<span class="co">#&gt; 6 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/aligned/chunked_bams/possorted_deduplicated_chr14.bam</span>
<span class="co">#&gt;                                                                                                        hdf5 paired  mate barcode chunk   meta</span>
<span class="co">#&gt; 1 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/ebd2_1/outs/filtered_gene_bc_matrices_h5.h5   TRUE first      CB     1 ebd2_1</span>
<span class="co">#&gt; 2 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/ebd2_1/outs/filtered_gene_bc_matrices_h5.h5   TRUE first      CB     1 ebd2_1</span>
<span class="co">#&gt; 3 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/ebd2_1/outs/filtered_gene_bc_matrices_h5.h5   TRUE first      CB     1 ebd2_1</span>
<span class="co">#&gt; 4 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/ebd2_1/outs/filtered_gene_bc_matrices_h5.h5   TRUE first      CB     2 ebd2_1</span>
<span class="co">#&gt; 5 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/ebd2_1/outs/filtered_gene_bc_matrices_h5.h5   TRUE first      CB     2 ebd2_1</span>
<span class="co">#&gt; 6 /net/mraid14/export/data/users/davidbr/proj/eseb/data//ebd2_1/ebd2_1/outs/filtered_gene_bc_matrices_h5.h5   TRUE first      CB     3 ebd2_1</span></code></pre></div>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">sc &lt;-<span class="st"> </span><span class="kw">addCounts</span>(sc,
                <span class="dt">bams     =</span> input_df,
                <span class="dt">bin_size =</span> <span class="dv">25</span>,
                <span class="dt">msa_dir  =</span> <span class="ot">NULL</span>,
                <span class="dt">use_gcluster =</span> <span class="ot">TRUE</span>)
<span class="co">#&gt; Preparing for distribution...</span>
<span class="co">#&gt; bamsgenestestes_3p</span>
<span class="co">#&gt; Running the commands...</span>
<span class="co">#&gt; 0%................2%.....5%...10%...15%...22%...25%.....27%...32%...35%...37%...42%...45%....52%...55%...62%...67%...70%....75%...82%....87%...90%....95%.......97%...........100%</span>
<span class="co">#&gt; Importing 10x gene counts from hdf5 file(s)</span>
<span class="co">#&gt; Computing genomic CPN of TE bins</span>
<span class="co">#&gt; Computing ribosomal/mitochondrial percentage per cell</span></code></pre></div>
</div>
<div id="call-cells" class="section level2">
<h2>Call cells</h2>
<p>To distinguish real cells from empty droplets, we utilize the <code>emptyDrops</code> function from the <a href="https://rdrr.io/github/MarioniLab/DropletUtils/">DropletUtils</a> package[1].</p>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">plotCells</span>(sc)
<span class="co">#&gt; Picking joint bandwidth of 1750</span>
<span class="co">#&gt; Picking joint bandwidth of 0.349</span></code></pre></div>
<p><img src="" style="display: block; margin: auto;" /></p>
</div>
<div id="mapping" class="section level2">
<h2>Mapping</h2>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">plotMapping</span>(sc)</code></pre></div>
<p><img src="" style="display: block; margin: auto;" /></p>
</div>
</div>
<div id="call-peaks" class="section level1">
<h1>Call peaks</h1>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">sc &lt;-<span class="st"> </span><span class="kw">selectPeaks</span>(sc)
<span class="co">#&gt; Calling peaks</span>
<span class="kw">plotPeaks</span>(sc)</code></pre></div>
<p><img src="" style="display: block; margin: auto;" /></p>
</div>
<div id="feature-selection" class="section level1">
<h1>Feature selection</h1>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r">sc &lt;-<span class="st"> </span><span class="kw">selectFeatures</span>(sc)
<span class="co">#&gt; Downsampling counts to 5500</span>
<span class="co">#&gt; Compating variance over mean</span>
<span class="co">#&gt; Running Louvain community detection</span>
<span class="co">#&gt; 5 communities found</span>
<span class="kw">plotFeatures</span>(sc)
<span class="co">#&gt; Joining, by = &quot;name&quot;</span>
<span class="co">#&gt; Joining, by = &quot;module&quot;</span></code></pre></div>
<p><img src="" style="display: block; margin: auto;" /></p>
</div>
<div id="references" class="section level1">
<h1>References</h1>
<p>[1]</p>
</div>
<div id="session-information" class="section level1">
<h1>Session information</h1>
<div class="sourceCode"><pre class="sourceCode r"><code class="sourceCode r"><span class="kw">sessionInfo</span>()
<span class="co">#&gt; R version 3.5.3 (2019-03-11)</span>
<span class="co">#&gt; Platform: x86_64-pc-linux-gnu (64-bit)</span>
<span class="co">#&gt; Running under: CentOS Linux 7 (Core)</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; Matrix products: default</span>
<span class="co">#&gt; BLAS/LAPACK: /net/mraid14/export/data/users/eladch/tools/CO7/mkl/2018.3/compilers_and_libraries_2018.3.222/linux/mkl/lib/intel64_lin/libmkl_gf_lp64.so</span>
<span class="co">#&gt; </span>
<span class="co">#&gt; locale:</span>
<span class="co">#&gt;  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8      </span>
<span class="co">#&gt;  [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       </span>
<span class="co">#&gt; </span>
<span class="co">#&gt; attached base packages:</span>
<span class="co">#&gt; [1] stats4    parallel  stats     graphics  grDevices datasets  utils     methods   base     </span>
<span class="co">#&gt; </span>
<span class="co">#&gt; other attached packages:</span>
<span class="co">#&gt;  [1] hexbin_1.27.2                      BSgenome.Mmusculus.UCSC.mm10_1.4.0 BSgenome_1.50.0                    rtracklayer_1.42.2                 Biostrings_2.50.2                 </span>
<span class="co">#&gt;  [6] XVector_0.22.0                     GenomicRanges_1.34.0               GenomeInfoDb_1.18.2                IRanges_2.16.0                     S4Vectors_0.20.1                  </span>
<span class="co">#&gt; [11] BiocGenerics_0.28.0                Repdata_0.0.0.9000                 Reputils_0.0.0.9000                Repsc_0.0.0.9000                   tgstat_2.3.2                      </span>
<span class="co">#&gt; [16] misha_4.0.4                       </span>
<span class="co">#&gt; </span>
<span class="co">#&gt; loaded via a namespace (and not attached):</span>
<span class="co">#&gt;   [1] colorspace_1.4-1            rjson_0.2.20                ellipsis_0.1.0              ggridges_0.5.1              rprojroot_1.3-2             GlobalOptions_0.1.0        </span>
<span class="co">#&gt;   [7] fs_1.2.7                    rstudioapi_0.9.0            listenv_0.7.0               remotes_2.0.2               ggrepel_0.8.0               ggfittext_0.8.1            </span>
<span class="co">#&gt;  [13] bit64_0.9-7                 codetools_0.2-16            R.methodsS3_1.7.1           phylogram_2.1.0             knitr_1.22                  pkgload_1.0.2              </span>
<span class="co">#&gt;  [19] Rsamtools_1.34.1            doMC_1.3.5                  R.oo_1.22.0                 compiler_3.5.3              backports_1.1.4             assertthat_0.2.1           </span>
<span class="co">#&gt;  [25] Matrix_1.2-16               lazyeval_0.2.2              cli_1.1.0                   treemapify_2.5.3            htmltools_0.3.6             prettyunits_1.0.2          </span>
<span class="co">#&gt;  [31] tools_3.5.3                 igraph_1.2.4                gtable_0.3.0                glue_1.3.1                  GenomeInfoDbData_1.2.0      reshape2_1.4.3             </span>
<span class="co">#&gt;  [37] dplyr_0.8.0.1               Rcpp_1.0.1                  Biobase_2.42.0              ape_5.3                     nlme_3.1-137                DECIPHER_2.10.2            </span>
<span class="co">#&gt;  [43] iterators_1.0.10            xfun_0.5                    stringr_1.4.0               globals_0.12.4              plyranges_1.2.0             ps_1.3.0                   </span>
<span class="co">#&gt;  [49] testthat_2.0.1              devtools_2.0.1              XML_3.98-1.19               future_1.13.0               zoo_1.8-4                   zlibbioc_1.28.0            </span>
<span class="co">#&gt;  [55] scales_1.0.0                SummarizedExperiment_1.12.0 RColorBrewer_1.1-2          yaml_2.2.0                  memoise_1.1.0               gridExtra_2.3              </span>
<span class="co">#&gt;  [61] ggplot2_3.1.0               stringi_1.4.3               RSQLite_2.1.1               desc_1.2.0                  foreach_1.4.4               kmer_1.1.1                 </span>
<span class="co">#&gt;  [67] pkgbuild_1.0.3              BiocParallel_1.16.6         rlang_0.3.2                 pkgconfig_2.0.2             matrixStats_0.54.0          bitops_1.0-6               </span>
<span class="co">#&gt;  [73] evaluate_0.13               lattice_0.20-38             purrr_0.3.2                 labeling_0.3                GenomicAlignments_1.18.1    cowplot_0.9.4              </span>
<span class="co">#&gt;  [79] bit_1.1-14                  processx_3.3.0              tidyselect_0.2.5            plyr_1.8.4                  magrittr_1.5                R6_2.4.0                   </span>
<span class="co">#&gt;  [85] DelayedArray_0.8.0          DBI_1.0.0                   pillar_1.3.1                withr_2.1.2                 RCurl_1.95-4.12             tibble_2.1.1               </span>
<span class="co">#&gt;  [91] crayon_1.3.4                hdf5r_1.2.0                 doFuture_0.8.0              rmarkdown_1.12              GetoptLong_0.1.7            usethis_1.4.0              </span>
<span class="co">#&gt;  [97] grid_3.5.3                  data.table_1.12.2           blob_1.1.1                  FNN_1.1.3                   callr_3.2.0                 forcats_0.4.0              </span>
<span class="co">#&gt; [103] digest_0.6.19               tidyr_0.8.3                 R.utils_2.8.0               munsell_0.5.0               fst_0.9.0                   viridisLite_0.3.0          </span>
<span class="co">#&gt; [109] sessioninfo_1.1.1</span></code></pre></div>
</div>



<!-- dynamically load mathjax for compatibility with self-contained -->
<script>
  (function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src  = "https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML";
    document.getElementsByTagName("head")[0].appendChild(script);
  })();
</script>

</body>
</html>
